package com.kornero.common.util;

import android.os.Message;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class MessageUtil {

    private static final DateFormat DATE_FORMAT = new SimpleDateFormat("EEE,d MMM yyyy HH:mm");

    public static Message valueOf(final Calendar calendar) {
        return valueOf(calendar, DATE_FORMAT);
    }

    public static Message valueOf(final Calendar calendar, final DateFormat format) {
        return valueOf(format.format(calendar.getTime()));
    }

    public static Message valueOf(final String text) {
        final Message message = new Message();
        message.obj = text;
        return message;
    }
}